package com.cdfy.system.service.impl;

import com.cdfy.common.annotation.DataScope;
import com.cdfy.common.core.domain.entity.SysUser;
import com.cdfy.system.mapper.SysUserMapper;
import com.cdfy.system.service.ISysUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户 业务层处理
 * 
 * @author songxl
 */
@Service
public class SysUserServiceImpl implements ISysUserService
{
    private static final Logger log=LoggerFactory.getLogger(SysUserServiceImpl.class);

    @Autowired(required=false)
    private SysUserMapper sysUserMapper;

    /**
     * 根据条件分页查询用户列表
     * 
     * @param user 用户信息
     * @return 用户信息集合信息
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "u")
    public List<SysUser> selectUserList(SysUser user) {
        return sysUserMapper.selectUserList(user);
    }

    /**
     * 通过用户名查询用户
     * 
     * @param userName 用户名
     * @return 用户对象信息
     */
    @Override
    public SysUser selectUserByUserName(String userName)
    {
        return sysUserMapper.selectUserByUserName(userName);
    }

    public static void main(String[] args){
        
    }
    /**
     * 通过用户ID查询用户
     * 
     * @param userId 用户ID
     * @return 用户对象信息
     */
    @Override
    public SysUser selectUserById(Long userId)
    {
        return sysUserMapper.selectUserById(userId);
    }
}
